package com.qianfeng.qlm.handforireader.model;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by LinXiangLin on 2015/3/26.
 */
public class ActiveBeanList {

    private List<ActiveBean> beanList;

    public void parseJson(JSONObject jsonObject){
        if (jsonObject != null){
            try {
                JSONArray activeArr = jsonObject.getJSONArray("active_arr");

                if (activeArr != null && activeArr.length() > 0){
                    beanList = new ArrayList<>();
                    for (int i = 0;i < activeArr.length();i++){
                        ActiveBean bean = new ActiveBean();
                        JSONObject activeArrJSONObject = activeArr.getJSONObject(i);
                        if (activeArrJSONObject != null){
                            bean.parseJson(activeArrJSONObject);
                            beanList.add(bean);
                        }
                    }
                }

            } catch (JSONException e) {
                e.printStackTrace();
            }

        }
    }

    public List<ActiveBean> getBeanList() {
        return beanList;
    }

    public void setBeanList(List<ActiveBean> beanList) {
        this.beanList = beanList;
    }
}
